﻿--删除员工职务
CREATE proc [dbo].[proc_Employee_ZhiWu_Delete]
(
	@id int
)
as
begin
   declare @Pid int
   
    set @Pid=(select Pid from Employee_ZhiWu where Id=@id)
	if @Pid=0  --一级节点

	 begin

	  delete from Employee_ZhiWu where Pid =@id
	  delete from Employee_ZhiWu WHERE Id=@id
	  
	  end

	else --二级节点

	 begin

	 
	  delete from Employee_ZhiWu where Id=@id

	  end
end